<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>百商汇</title>
	<meta name="viewport" content="initial-scale = 1.0,maximum-scale = 1.0,minimum-scale = 1.0,user-scalable = no,width = device-width">
	<meta name="format-detection" content="telephone=no" />
	<link rel="stylesheet" type="text/css" href="../csses/merchantsDetail.css">
	<script type="text/javascript">
		onload = function(){
			$('.hiddenBox').hide();
		}
	</script>
</head>
<body>
	<div class="merchantsDetail_title">
		<p></p>
		<img src="../image/back.png" onclick="goBack()">
	</div>
	<div class="merchantsDetail_box">
		<div class="top">
			<img >
			<div>
				<p class="p1"></p>
				<p class="p2"></p>
			</div>
		</div>
		<p class="address p"></p>
		<p class="telNum p"></p>
		<p class="describe p"></p>
		<div class="merPicList">
			<img class="merImgCover">
			<img class="merShowImg1">
			<img class="merShowImg2">
		</div>
	</div>

	<div class="hiddenBox">
		
	</div>
	

	<script type="text/javascript" src="../lib/flexible.js"></script>
	<script type="text/javascript" src="../lib/jquery-1.10.1.min.js"></script>
	<script type="text/javascript">
		function goBack(){
			window.history.back();
		}

		$.ajax({
			type : 'post',
			url : '/api/v1/merchant/H5MerchantDetail',
			dataType : 'json',
			data : {
				paramStr: "{'merchant_id':'" + sessionStorage.merchantId + "'}"
			},
			timeout : 10000,
			success : function (data) {
				if(data.code == 200){
					var obj = JSON.parse(data.data);
					var shopDetail = obj.shop_detail;
					$('.top img').attr('src',shopDetail.imgCover);
					$('.p1').text('商户名：' + shopDetail.merchantName);
					$('.p2').text('联系人：' + shopDetail.linkman);
					$('.address').text('地址：' + shopDetail.address);
					$('.telNum').text('电话：' + shopDetail.mobile);
					$('.describe').text('商户描述：' + shopDetail.traderDesc);
					$('.merchantsDetail_title p').text(shopDetail.merchantName);

					$('.merImgCover').attr('src',shopDetail.imgCover);
					if(!shopDetail.showImg1){
						$('.merShowImg1').hide();
					}else{
						$('.merShowImg1').attr('src',shopDetail.showImg1);
					}

					if(!shopDetail.showImg2){
						$('.merShowImg2').hide();
					}else{
						$('.merShowImg2').attr('src',shopDetail.showImg2);
					}

					$('.merPicList img').bind('click',function(){
						sessionStorage.src = $(this).attr('src');
						$('.hiddenBox').show();
						$('<img/>').attr('src',sessionStorage.src).appendTo($('.hiddenBox'));
						var $width = $('.hiddenBox img').width();
						var $height = $('.hiddenBox img').height();
						$('.hiddenBox img').css('width',10 + 'rem').css('height',10/($width/$height) + 'rem');
						$('.hiddenBox').bind('click',function(){
							$('.hiddenBox img').remove();
							$('.hiddenBox').hide();
						});
					});
				}
			},
			error : function (xhr,type,errorThrown){

			}
		});
	</script>
</body>
</html>